package ninja.awesome.framework.control;

import java.util.List;

import ninja.awesome.framework.Game;
import ninja.awesome.framework.Graphics;
import ninja.awesome.framework.Image;
import ninja.awesome.framework.Input.TouchEvent;
import android.graphics.Color;

public class Widget {
	protected int x;
	protected int y;
	protected int width;
	protected int height;
	protected int borderColor;
	protected int backgroundColor;
	protected int cornerRadius;
	protected Image backgroundImage;
	protected Game game;

	public Widget(Game game) {
		setBorderColor(Color.TRANSPARENT);
		this.game = game;
	}

	public void paint(float deltaTime) {
		Graphics g = game.getGraphics();
		if (backgroundImage == null) {
			g.drawRect(getX(), getY(), getWidth(), getHeight(), backgroundColor);
		} else {
			g.drawImage(backgroundImage, getX(), getY());
		}
	}

	public void update(float deltaTime, List<TouchEvent> touchEvents) {

	}

	public void setPosition(int x, int y, int width, int height) {
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
	}

	public int getBackgroundColor() {
		return backgroundColor;
	}

	public void setBackgroundColor(int backgroundColor) {
		this.backgroundColor = backgroundColor;
	}

	public void setBackgroundImage(Image image) {
		this.backgroundImage = image;
	}

	public int getBorderColor() {
		return borderColor;
	}

	public void setBorderColor(int borderColor) {
		this.borderColor = borderColor;
	}

	public int getCornerRadius() {
		return cornerRadius;
	}

	public void setCornerRadius(int cornerRadius) {
		this.cornerRadius = cornerRadius;
	}

	public int getX() {
		return x;
	}

	public void setLeft(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setTop(int y) {
		this.y = y;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

}
